import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:osc/common/osc_user_manager.dart';
import 'package:osc/res/dimens.dart';
import 'package:osc/ui/pages/common_page.dart';
import 'package:osc/ui/pages/medal/medal_list.dart';
import 'package:osc/ui/widgets/common_tab_bar.dart';

class MedalPage extends StatelessWidget {
  final int userId;
  final int gender;
  ///1:身份勋章，2:问答勋章，3:活动勋章，4:贡献勋章，
  const MedalPage({Key key, @required this.userId, this.gender = 1,}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CommonPage(
        title: userId == OscUserManager().getUserId()?"我的勋章":"Ta的勋章",
        body: CommonTabBar(
            tabs: [
              buildTab(text: "身份勋章",),
              buildTab(text: "问答勋章",),
              buildTab(text: "活动勋章",),
              buildTab(text: "贡献勋章",),
            ],
            pages: [
              MedalList(userId: userId, type: 1,),
              MedalList(userId: userId, type: 2,),
              MedalList(userId: userId, type: 3,),
              MedalList(userId: userId, type: 4,),
            ]
        ),
    );
  }

  buildTab({String text}){
    return Tab(
      child: Text(text, style: TextStyle(fontSize: Dimens.font_sp14),),
    );
  }
}
